<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
        <meta name="description" content="Page Description">
        <meta name="author" content="Administrator">
        <meta name="csrf_token" content="{{ csrf_token() }}">
        <title>Page Title</title>
        <!-- Bootstrap -->
        <link href="{{ asset('vendor/bootstrap/dist/js/bootstrap.min.js') }}" rel="stylesheet">
    </head>
    <body>
        <h1>Body</h1>
        <button id="click-ajax" type="button" class="btn btn-success">click</button>

        <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
        <script src="{{ asset('vendor/jquery/dist/jquery.min.js') }}"></script>
        <!-- Include all compiled plugins (below), or include individual files as needed -->
        <script src="{{ asset('vendor/bootstrap/dist/js/bootstrap.min.js') }}"></script>
        <script type="text/javascript">
            $(document).ready(function () {
                var token = $("meta[name='csrf_token']").attr('content').trim();
                console.log(token);
                var url = 'http://127.0.0.1:8000/getmsg';

                $("#click-ajax").click(function () {
                    $.get(url,{_token:token},function (res) {
                        if(res){
                            console.log(res.msg)
                        }
                    })
                });
            });
        </script>
    </body>
</html>